package com.supreme.secretserver.secret;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.StringUtils;

import java.io.InputStream;

public interface SecretParser {

    String AES = "AES";
    String RSA = "RSA";

    static boolean isJsonBody(String bodyString) {
        return StringUtils.startsWith(bodyString, "{") && StringUtils.endsWith(bodyString, "}");
    }

    InputStream buildStringInputStream(String bodyString, String decryptKey, byte[] secretBytes) throws Exception;

    InputStream buildJsonInputStream(byte[] bodyBytes, ObjectMapper objectMapper, String decryptKey, byte[] secretBytes) throws Exception;
}
